package com.ymatou.iapi.openapibiz.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*创建第三方应用appCall
*FreeMaker Template自动生成代码
*/
public class NewThirdPartyAppCall extends YmatouBaseCall{
	private static String opurl ="/authmanager/newThirdPartyApp";
	
	public NewThirdPartyAppCall() {
		super(EnvSetup.getSystemUrl("openapibiz"),opurl,"POST","JSON");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getMessage() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("message");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getContent() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("content");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getAppId() {
		String Code = null;
		try {
			Code = new JSONObject(getContent()).getString("appId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getAppName() {
		String Code = null;
		try {
			Code = new JSONObject(getContent()).getString("appName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getAppSecret() {
		String Code = null;
		try {
			Code = new JSONObject(getContent()).getString("appSecret");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
}